##ONLINE APPENDIX
# Apendix Table A1: Sample Composition on Key Variables
df <- data[c('male','college','age','minority_sect','muhajir','a_victim')]
stargazer(df,title="Table A1: Sample Composition on Key Variables",covariate.labels=c("Male","College","Age","Minority Sect","Muhajir","Violence Victim"),summary.stat = c("n","mean","sd","min","p25", "p75","max"),out="output/tables/tableA1.tex")
#Appendix Table C2: "Assignment" to Third Party Presence at Interview
c1 <- felm(others ~ age + male + college|0|0|0, data=data)
c2 <- felm(others ~ age + male + college + large_fam + muhajir + minority_sect + a_victim|0|0|0, data=data)
c3 <- felm(others ~ age + male + college + large_fam + muhajir + minority_sect + a_victim + coenum|0|0|0, data=data)
stargazer(c1,c2,c3,title="Table C2: Assignment to Third Party Presence at Interview",dep.var.labels=c("Others"),
covariate.labels=c("Age","Male","College","Lrgfam","Muhajir","Minority Sect","Victim","Coenum"), out="output/tables/tableC2.tex")
#Appendix Table D3: Created from main results above
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table D3: Association of Third Party Presence with Ethnicity Variables", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ")
,covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableD3.tex")
#Appendix Table D4: Bivariate Association of Third Party Presence with Ethnicity Variables (i.e. main analyses without controls)
bivar1 <- felm(felt_disc ~ others|0|0|0, data=data)
bivar2 <- felm(trustpremium  ~ others|0|0|0, data=data)
bivar3 <- felm(conflict_inev ~ others|0|0|0, data=data)
bivar4 <- felm(harmony_poss ~ others|0|0|0, data=data)
bivar5 <- felm(vote_coethnic ~ others|0|0|0, data=data)
bivar6 <- felm(parties_genuine ~ others|0|0|0, data=data)
bivar7 <- felm(e_identity ~ others|0|0|0, data=data)
bivar8 <- felm(e_interests ~ others|0|0|0, data=data)
bivar9 <- felm(ethnic_party ~ others|0|0|0, data=data)
bivar10 <- felm(fear_violence ~ others|0|0|0, data=data)
bivar11 <- felm(econ ~ others|0|0|0, data=data)
df <- list(bivar1, bivar2, bivar3, bivar4, bivar5, bivar6, bivar7, bivar8, bivar9, bivar10, bivar11)
stargazer(df,out="output/tables/tableD4.tex")
#Appendix Table E5: Sensitivity Analysis
f1 <- lm(econ ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f2 <- lm(fear_violence ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f3 <- lm(ethnic_party ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f4 <- lm(e_interests ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f5 <- lm(parties_genuine ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f6 <- lm(vote_coethnic ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f7 <- lm(harmony_poss ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f8 <- lm(felt_disc ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
s1 <- sensemakr(f1,treatment="others")
s2 <- sensemakr(f2,treatment="others")
s3 <- sensemakr(f3,treatment="others")
s4 <- sensemakr(f4,treatment="others")
s5 <- sensemakr(f5,treatment="others")
s6 <- sensemakr(f6,treatment="others")
s7 <- sensemakr(f7,treatment="others")
s8 <- sensemakr(f8,treatment="others")
e4 <- data.frame(rbind(c(s1$se[,2],s1$se[,3],s1$se[,4],s1$se[,5],s1$se[,6],s1$se[,7]),
c(s2$se[,2],s2$se[,3],s2$se[,4],s2$se[,5],s2$se[,6],s2$se[,7]),
c(s3$se[,2],s3$se[,3],s3$se[,4],s3$se[,5],s3$se[,6],s3$se[,7]),
c(s4$se[,2],s4$se[,3],s4$se[,4],s4$se[,5],s4$se[,6],s4$se[,7]),
c(s5$se[,2],s5$se[,3],s5$se[,4],s5$se[,5],s5$se[,6],s5$se[,7]),
c(s6$se[,2],s6$se[,3],s6$se[,4],s6$se[,5],s6$se[,6],s6$se[,7]),
c(s7$se[,2],s7$se[,3],s7$se[,4],s7$se[,5],s7$se[,6],s7$se[,7]),
c(s8$se[,2],s8$se[,3],s8$se[,4],s8$se[,5],s8$se[,6],s8$se[,7])))
colnames(e4) <-  c("Coef.", "S.E.","t(H0)","R2Y~D|X","RV_q","RV_qa")
rownames(e4) <- c("Economic Conditions Worse","Fear Ethnic Violence","Support Ethnic Party","Material Interests","Genuine Violence","Vote Coethnic","Harmony Possible","Felt Discrimination")
print(xtable(e4,type="latex",digits=4,caption="Table E5: Sensitivity Analysis"), caption.placement = 'top',file="output/tables/tableE5.tex")
# Figure E1
## Outsheeting figures on sensitivity analysis
f1 <- lm(econ ~ others + age + female + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
s1 <- sensemakr(model = f1,treatment="others",benchmark_covariates="female", kd = 1:3)
s1
png("output/figures/figure2E1.png", width = 804, height = 478)
plot(s1)
dev.off()
png("output/figures/figure2E2.png", width = 804, height = 478)
plot(s1, sensitivity.of="t-value")
dev.off()
#Appendix Table E6: Results without using victimization as a control
post1 <- felm(felt_disc ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post2 <- felm(trustpremium  ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post3 <- felm(conflict_inev ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post4 <- felm(harmony_poss ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post5 <- felm(vote_coethnic ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post6 <- felm(parties_genuine ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post7 <- felm(e_identity ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post8 <- felm(e_interests ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post9 <- felm(ethnic_party ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post11 <- felm(econ ~ others + age + male + college + muhajir + coenum + large_fam|0|0|0, data=data)
df2 <- list(post1,post2,post3,post4, post5, post6, post7, post8, post9, post10, post11)
stargazer(df2, out="output/tables/tableE6.tex")
#Appendix Table E7: Results after exlcluding the respondents marked as 'very distracted'
f1 <- felm(felt_disc ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f2 <- felm(trustpremium  ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f3 <- felm(conflict_inev ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f4 <- felm(harmony_poss ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f5 <- felm(vote_coethnic ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f6 <- felm(parties_genuine ~ others + age + male + college + muhajir + coenum +   + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f7 <- felm(e_identity ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f8 <- felm(e_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f9 <- felm(ethnic_party ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f11 <- felm(econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E7: Results After Excluding Those Marked as `Very Distracted' (N=172)", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableE7.tex")
#Appendix Table E8: Main regressions over outcomes coded as binary
f1 <- felm(binary_disc ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(binarypremium  ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f3 <- felm(binary_conflict ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f4 <- felm(binary_harmony ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f5 <- felm(binary_vote ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f6 <- felm(binary_genuine ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f7 <- felm(binary_identity ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f8 <- felm(binary_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f9 <- felm(binary_party ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f11 <- felm(binary_econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E8: Results With All Outcomes Coded as Binary Variables", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableE8.tex")
#Appendix Table E9: Logit regressions over outcomes coded as binary
f1 <- glm(formula = binary_disc ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f2 <- glm(formula = binarypremium  ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f3 <- glm(formula = binary_conflict ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f4 <- glm(formula = binary_harmony ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f5 <- glm(formula = binary_vote ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f6 <- glm(formula = binary_genuine ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f7 <- glm(formula = binary_identity ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f8 <- glm(formula = binary_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f9 <- glm(formula = binary_party ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f10 <- glm(formula = fear_violence ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f11 <- glm(formula = binary_econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E9: Results Using Binary Outcomes and Logistic Regression", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n")
, out="output/tables/tableE9.tex")
#Appendix Table E10: Results with combined measure (PCA) as outcome
## PCA analysis for outcome
#impute missing values
outcome_vars <- dplyr::select(data, felt_disc, trustpremium, conflict_inev, harmony_poss, vote_coethnic,
parties_genuine, e_identity, e_interests, ethnic_party, fear_violence, econ)
nb <- estim_ncpPCA(outcome_vars,method.cv = "Kfold", verbose = FALSE) # estimate the number of components from incomplete data
#(available methods include GCV to approximate CV)
nb$ncp #3
res.comp <- imputePCA(outcome_vars, ncp = nb$ncp) # iterativePCA algorithm
res.comp$completeObs[1:3,]  # first three rows of the imputed data set
imp <- as.data.frame(res.comp$completeObs) #the imputed data set saved as data frame
outcome.index <- prcomp(~felt_disc+trustpremium+conflict_inev+harmony_poss+vote_coethnic+parties_genuine+e_identity+e_interests+ethnic_party+fear_violence+econ, data=imp,
center=T, scale=T, retx=T)
summary(outcome.index)
data$imputedindex <- outcome.index$x[, 1]
#now use the index as the outcome
f1 <- felm(imputedindex ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,title="Table E10:Results with Combined Measure as Outcome",dep.var.labels=c("PCA Measure"),
covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"),keep.stat=c("n","rsq"), out="output/tables/tableE10.tex")
#Appendix Table E11: Main regressions but restricting sample to control group
f1 <- felm(felt_disc ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f2 <- felm(trustpremium  ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f3 <- felm(conflict_inev ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f4 <- felm(harmony_poss ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f5 <- felm(vote_coethnic ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f6 <- felm(parties_genuine ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f7 <- felm(e_identity ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f8 <- felm(e_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f9 <- felm(ethnic_party ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f11 <- felm(econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E11: Results When Restricting Survey Sample to Control Group", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableE11.tex")
#Appendix Table F12: Main regressions with interaction between gender and Third Party Presence
f1 <- felm(felt_disc ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(trustpremium  ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f3 <- felm(conflict_inev ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f4 <- felm(harmony_poss ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f5 <- felm(vote_coethnic ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f6 <- felm(parties_genuine ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f7 <- felm(e_identity ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f8 <- felm(e_interests ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f9 <- felm(ethnic_party ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f10 <- felm(fear_violence ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f11 <- felm(econ ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table F12: Interacting Third Party Presence with Gender", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Male", "Others*Male","Age","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableF12.tex")
#Appendix Table F13: Association Between Third Party Presence and Additional Variables
f1 <- felm(soaps ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(interest_politics ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f3 <- felm(coord_vote ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,f3,title="Table F13: Association Between Third Party Presence and Additional Variables", dep.var.labels=c("Soap Operas","Interest in Politics","Coordinate Vote"),covariate.labels=c("Others","Male","Age","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableF13.tex")
#Appendix Table F14: Association Between Third Party Presence and Non-Sensitive Outcomes
f1 <- felm(kelectric ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(cpec ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,title="Table F14: Association Between Third Party Presence and Non-Sensitive Outcomes", dep.var.labels=c("Kelectric", "CPEC"),covariate.labels=c("Others","Male","Age","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableF14.tex")
#Appendix Tables F15-F25: Two by Twos of Third Party Presence and Enumerator Coethnicity
tapply(data$econ, list(data$others,data$coenum), mean, na.r=TRUE) #F15
tapply(data$fear_violence, list(data$others,data$coenum), mean, na.r=TRUE) #F16
tapply(data$felt_disc, list(data$others,data$coenum), mean, na.r=TRUE) #F17
tapply(data$vote_coethnic, list(data$others,data$coenum), mean, na.r=TRUE) #F18
tapply(data$parties_genuine, list(data$others,data$coenum), mean, na.r=TRUE) #F19
tapply(data$e_identity, list(data$others,data$coenum), mean, na.r=TRUE)  #F20
tapply(data$e_interests, list(data$others,data$coenum), mean, na.r=TRUE) #F21
tapply(data$ethnic_party, list(data$others,data$coenum), mean, na.r=TRUE) #F22
tapply(data$trustpremium, list(data$others,data$coenum), mean, na.r=TRUE) #F23
tapply(data$conflict_inev, list(data$others,data$coenum), mean, na.r=TRUE) #F24
tapply(data$harmony_poss, list(data$others,data$coenum), mean, na.r=TRUE) #F25
# Project: Third Party Presence & the Political Salience of Ethnicity in Survey Data
# Activity: Replication R code
# Time: February 2023
# Clear workspace
rm(list = ls())
# Install packages section
#install.packages("devtools")
#install_github("husson/missMDA")
#install.packages("sensemakr")
# Setting up wd
setwd("/Users/mashailmalik/Dropbox/Projects/USIP elections/Final Data/USIP Data/Replication folder")
# Load packages
#update.packages()
library(tidyverse)
library(ggplot2)
library(magrittr)
library(foreign)
library(haven)
library(plyr); library(dplyr)
library(tidyr)
library(memisc)
library(cobalt)
library(foreign)
library(gridExtra)
library(lmtest)
library(sandwich)
library(lfe)
library(stargazer)
library(devtools)
library(missMDA)
library(sensemakr)
library(xtable)
library(foreign)
library(stargazer)
# Loading data
sink("./log/analysis_log.txt")
#file.choose()
data <- read.csv("usedata/analysis_dataset.csv")
##MAIN RESULTS
##Main Regressions Behind Figure 1 in Text
f1 <- felm(felt_disc ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(trustpremium  ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f3 <- felm(conflict_inev ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f4 <- felm(harmony_poss ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f5 <- felm(vote_coethnic ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f6 <- felm(parties_genuine ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f7 <- felm(e_identity ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f8 <- felm(e_interests ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f9 <- felm(ethnic_party ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
f11 <- felm(econ ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=data)
##Figure 1 in Text
##PLOT FOR OTHERS PRESENT
eleven <- data.frame(rbind(c(f1$coefficients[2], f1$se[2]),
c(f2$coefficients[2], f2$se[2]),
c(f3$coefficients[2], f3$se[2]),
c(f4$coefficients[2], f4$se[2]),
c(f5$coefficients[2], f5$se[2]),
c(f6$coefficients[2], f6$se[2]),
c(f7$coefficients[2], f7$se[2]),
c(f8$coefficients[2], f8$se[2]),
c(f9$coefficients[2], f9$se[2]),
c(f10$coefficients[2], f10$se[2]),
c(f11$coefficients[2], f11$se[2])))
colnames(eleven) <-  c("coefficient", "se")
eleven$model <- c(1,2,3,4,5,6,7,8,9,10,11)
eleven$model <- factor(eleven$model, levels=c(1,2,3,4,5,6,7,8,9,10,11),
labels= c("Felt Discrimination", "Coethnic Trust Premium", "Conflict Inevitable", "Harmony Possible", "Vote Coethnic",
"Genuine Violence", "Ethnic Identity Importance", "Material Interests", "Support Ethnic Party", "Fear Ethnic Violence",
"Economic Conditions Worse"))
p <- ggplot(data = eleven, mapping = aes(x = model,
y = coefficient, col=model)) +
geom_hline(yintercept = 0, lty=2) +
geom_pointrange(mapping = aes(ymin = coefficient - 1.96*se,
ymax = coefficient + 1.96*se),
size=.75) +
theme_classic() +
scale_color_manual(values=c("firebrick3", "gray30", "gray30", "firebrick3", "firebrick3", "firebrick3", "firebrick3", "firebrick3", "firebrick3", "firebrick3", "firebrick3"), name="") +
labs(x= "", y= "")  +
#geom_text(aes(label=Name, hjust=1.2, vjust=1.5)) +
theme(axis.title=element_text(size=12, face="bold"),
axis.text.x = element_text(size=10, angle=90),
axis.text.y=element_text(size=10),
axis.title.x = element_blank(),
legend.title = element_text(size=12, face="bold"),
legend.position="none")
p2 <- p + coord_flip() + ylim(-0.3,0.65) + ggtitle("Impact of Others Present") +  theme(plot.title = element_text(hjust = 0.5,vjust = 4))
p2 <- p2 + theme(plot.margin = margin(20,20,20,20))
##PLOT FOR COETHNIC ENUMERATOR
eleven1 <- data.frame(rbind(c(f1$coefficients[7], f1$se[7]),
c(f2$coefficients[7], f2$se[7]),
c(f3$coefficients[7], f3$se[7]),
c(f4$coefficients[7], f4$se[7]),
c(f5$coefficients[7], f5$se[7]),
c(f6$coefficients[7], f6$se[7]),
c(f7$coefficients[7], f7$se[7]),
c(f8$coefficients[7], f8$se[7]),
c(f9$coefficients[7], f9$se[7]),
c(f10$coefficients[7], f10$se[7]),
c(f11$coefficients[7], f11$se[7])))
colnames(eleven1) <-  c("coefficient", "se")
eleven1$model <- c(1,2,3,4,5,6,7,8,9,10,11)
eleven1$model <- factor(eleven1$model, levels=c(1,2,3,4,5,6,7,8,9,10,11),
labels= c("Felt Discrimination", "Coethnic Trust Premium", "Conflict Inevitable", "Harmony Possible", "Vote Coethnic",
"Genuine Violence", "Ethnic Identity Importance", "Material Interests", "Support Ethnic Party", "Fear Ethnic Violence",
"Economic Conditions Worse"))
p3 <- ggplot(data = eleven1, mapping = aes(x = model,
y = coefficient, col=model)) +
geom_hline(yintercept = 0, lty=2) +
geom_pointrange(mapping = aes(ymin = coefficient - 1.96*se,
ymax = coefficient + 1.96*se),
size=.75) +
theme_classic() +
scale_color_manual(values=c("firebrick3", "gray30", "gray30", "gray30", "firebrick3", "firebrick3", "gray30", "firebrick3", "firebrick3", "firebrick3", "firebrick3"), name="") +
labs(x= "", y= "")  +
#geom_text(aes(label=Name, hjust=1.2, vjust=1.5)) +
theme(axis.title=element_text(size=12, face="bold"),
axis.text.x = element_text(size=10, angle=90),
axis.text.y=element_text(size=10),
axis.title.x = element_blank(),
legend.title = element_text(size=12, face="bold"),
legend.position="none")
p4 <- p3 + coord_flip() + ylim(-0.3,0.65) + ggtitle("Impact of Enumerator Coethnicity")  +  theme(plot.title = element_text(hjust = 0.5,vjust=4))
p4 <- p4 + theme(plot.margin = margin(20,20,20,20))
figure1 <- grid.arrange(p2,p4,ncol=2)
ggsave("output/figures/figure1.png", figure1, width=14, height=10)
##ONLINE APPENDIX
# Apendix Table A1: Sample Composition on Key Variables
df <- data[c('male','college','age','minority_sect','muhajir','a_victim')]
stargazer(df,title="Table A1: Sample Composition on Key Variables",covariate.labels=c("Male","College","Age","Minority Sect","Muhajir","Violence Victim"),summary.stat = c("n","mean","sd","min","p25", "p75","max"),out="output/tables/tableA1.tex")
#Appendix Table C2: "Assignment" to Third Party Presence at Interview
c1 <- felm(others ~ age + male + college|0|0|0, data=data)
c2 <- felm(others ~ age + male + college + large_fam + muhajir + minority_sect + a_victim|0|0|0, data=data)
c3 <- felm(others ~ age + male + college + large_fam + muhajir + minority_sect + a_victim + coenum|0|0|0, data=data)
stargazer(c1,c2,c3,title="Table C2: Assignment to Third Party Presence at Interview",dep.var.labels=c("Others"),
covariate.labels=c("Age","Male","College","Lrgfam","Muhajir","Minority Sect","Victim","Coenum"), out="output/tables/tableC2.tex")
#Appendix Table D3: Created from main results above
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table D3: Association of Third Party Presence with Ethnicity Variables", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ")
,covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableD3.tex")
#Appendix Table D4: Bivariate Association of Third Party Presence with Ethnicity Variables (i.e. main analyses without controls)
bivar1 <- felm(felt_disc ~ others|0|0|0, data=data)
bivar2 <- felm(trustpremium  ~ others|0|0|0, data=data)
bivar3 <- felm(conflict_inev ~ others|0|0|0, data=data)
bivar4 <- felm(harmony_poss ~ others|0|0|0, data=data)
bivar5 <- felm(vote_coethnic ~ others|0|0|0, data=data)
bivar6 <- felm(parties_genuine ~ others|0|0|0, data=data)
bivar7 <- felm(e_identity ~ others|0|0|0, data=data)
bivar8 <- felm(e_interests ~ others|0|0|0, data=data)
bivar9 <- felm(ethnic_party ~ others|0|0|0, data=data)
bivar10 <- felm(fear_violence ~ others|0|0|0, data=data)
bivar11 <- felm(econ ~ others|0|0|0, data=data)
df <- list(bivar1, bivar2, bivar3, bivar4, bivar5, bivar6, bivar7, bivar8, bivar9, bivar10, bivar11)
stargazer(df,out="output/tables/tableD4.tex")
#Appendix Table E5: Sensitivity Analysis
f1 <- lm(econ ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f2 <- lm(fear_violence ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f3 <- lm(ethnic_party ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f4 <- lm(e_interests ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f5 <- lm(parties_genuine ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f6 <- lm(vote_coethnic ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f7 <- lm(harmony_poss ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
f8 <- lm(felt_disc ~ others + age + male + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
s1 <- sensemakr(f1,treatment="others")
s2 <- sensemakr(f2,treatment="others")
s3 <- sensemakr(f3,treatment="others")
s4 <- sensemakr(f4,treatment="others")
s5 <- sensemakr(f5,treatment="others")
s6 <- sensemakr(f6,treatment="others")
s7 <- sensemakr(f7,treatment="others")
s8 <- sensemakr(f8,treatment="others")
e4 <- data.frame(rbind(c(s1$se[,2],s1$se[,3],s1$se[,4],s1$se[,5],s1$se[,6],s1$se[,7]),
c(s2$se[,2],s2$se[,3],s2$se[,4],s2$se[,5],s2$se[,6],s2$se[,7]),
c(s3$se[,2],s3$se[,3],s3$se[,4],s3$se[,5],s3$se[,6],s3$se[,7]),
c(s4$se[,2],s4$se[,3],s4$se[,4],s4$se[,5],s4$se[,6],s4$se[,7]),
c(s5$se[,2],s5$se[,3],s5$se[,4],s5$se[,5],s5$se[,6],s5$se[,7]),
c(s6$se[,2],s6$se[,3],s6$se[,4],s6$se[,5],s6$se[,6],s6$se[,7]),
c(s7$se[,2],s7$se[,3],s7$se[,4],s7$se[,5],s7$se[,6],s7$se[,7]),
c(s8$se[,2],s8$se[,3],s8$se[,4],s8$se[,5],s8$se[,6],s8$se[,7])))
colnames(e4) <-  c("Coef.", "S.E.","t(H0)","R2Y~D|X","RV_q","RV_qa")
rownames(e4) <- c("Economic Conditions Worse","Fear Ethnic Violence","Support Ethnic Party","Material Interests","Genuine Violence","Vote Coethnic","Harmony Possible","Felt Discrimination")
print(xtable(e4,type="latex",digits=4,caption="Table E5: Sensitivity Analysis"), caption.placement = 'top',file="output/tables/tableE5.tex")
# Figure E1
## Outsheeting figures on sensitivity analysis
f1 <- lm(econ ~ others + age + female + college + muhajir + coenum + gender_mismatch + large_fam + a_victim, data=data)
s1 <- sensemakr(model = f1,treatment="others",benchmark_covariates="female", kd = 1:3)
s1
png("output/figures/figure2E1.png", width = 804, height = 478)
plot(s1)
dev.off()
png("output/figures/figure2E2.png", width = 804, height = 478)
plot(s1, sensitivity.of="t-value")
dev.off()
#Appendix Table E6: Results without using victimization as a control
post1 <- felm(felt_disc ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post2 <- felm(trustpremium  ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post3 <- felm(conflict_inev ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post4 <- felm(harmony_poss ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post5 <- felm(vote_coethnic ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post6 <- felm(parties_genuine ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post7 <- felm(e_identity ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post8 <- felm(e_interests ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post9 <- felm(ethnic_party ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum  + large_fam|0|0|0, data=data)
post11 <- felm(econ ~ others + age + male + college + muhajir + coenum + large_fam|0|0|0, data=data)
df2 <- list(post1,post2,post3,post4, post5, post6, post7, post8, post9, post10, post11)
stargazer(df2, out="output/tables/tableE6.tex")
#Appendix Table E7: Results after exlcluding the respondents marked as 'very distracted'
f1 <- felm(felt_disc ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f2 <- felm(trustpremium  ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f3 <- felm(conflict_inev ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f4 <- felm(harmony_poss ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f5 <- felm(vote_coethnic ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f6 <- felm(parties_genuine ~ others + age + male + college + muhajir + coenum +   + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f7 <- felm(e_identity ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f8 <- felm(e_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f9 <- felm(ethnic_party ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
f11 <- felm(econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,distracted==0))
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E7: Results After Excluding Those Marked as `Very Distracted' (N=172)", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableE7.tex")
#Appendix Table E8: Main regressions over outcomes coded as binary
f1 <- felm(binary_disc ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(binarypremium  ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f3 <- felm(binary_conflict ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f4 <- felm(binary_harmony ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f5 <- felm(binary_vote ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f6 <- felm(binary_genuine ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f7 <- felm(binary_identity ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f8 <- felm(binary_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f9 <- felm(binary_party ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f11 <- felm(binary_econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E8: Results With All Outcomes Coded as Binary Variables", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableE8.tex")
#Appendix Table E9: Logit regressions over outcomes coded as binary
f1 <- glm(formula = binary_disc ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f2 <- glm(formula = binarypremium  ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f3 <- glm(formula = binary_conflict ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f4 <- glm(formula = binary_harmony ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f5 <- glm(formula = binary_vote ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f6 <- glm(formula = binary_genuine ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f7 <- glm(formula = binary_identity ~ others + age + male + college + muhajir + coenum  + large_fam + a_victim, family = "binomial", data=data)
f8 <- glm(formula = binary_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f9 <- glm(formula = binary_party ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f10 <- glm(formula = fear_violence ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
f11 <- glm(formula = binary_econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim, family = "binomial", data=data)
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E9: Results Using Binary Outcomes and Logistic Regression", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n")
, out="output/tables/tableE9.tex")
#Appendix Table E10: Results with combined measure (PCA) as outcome
## PCA analysis for outcome
#impute missing values
outcome_vars <- dplyr::select(data, felt_disc, trustpremium, conflict_inev, harmony_poss, vote_coethnic,
parties_genuine, e_identity, e_interests, ethnic_party, fear_violence, econ)
nb <- estim_ncpPCA(outcome_vars,method.cv = "Kfold", verbose = FALSE) # estimate the number of components from incomplete data
#(available methods include GCV to approximate CV)
nb$ncp #3
res.comp <- imputePCA(outcome_vars, ncp = nb$ncp) # iterativePCA algorithm
res.comp$completeObs[1:3,]  # first three rows of the imputed data set
imp <- as.data.frame(res.comp$completeObs) #the imputed data set saved as data frame
outcome.index <- prcomp(~felt_disc+trustpremium+conflict_inev+harmony_poss+vote_coethnic+parties_genuine+e_identity+e_interests+ethnic_party+fear_violence+econ, data=imp,
center=T, scale=T, retx=T)
summary(outcome.index)
data$imputedindex <- outcome.index$x[, 1]
#now use the index as the outcome
f1 <- felm(imputedindex ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,title="Table E10:Results with Combined Measure as Outcome",dep.var.labels=c("PCA Measure"),
covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"),keep.stat=c("n","rsq"), out="output/tables/tableE10.tex")
#Appendix Table E11: Main regressions but restricting sample to control group
f1 <- felm(felt_disc ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f2 <- felm(trustpremium  ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f3 <- felm(conflict_inev ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f4 <- felm(harmony_poss ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f5 <- felm(vote_coethnic ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f6 <- felm(parties_genuine ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f7 <- felm(e_identity ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f8 <- felm(e_interests ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f9 <- felm(ethnic_party ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f10 <- felm(fear_violence ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
f11 <- felm(econ ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=subset(data,rand_exp1=="V1"))
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table E11: Results When Restricting Survey Sample to Control Group", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Age","Male","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableE11.tex")
#Appendix Table F12: Main regressions with interaction between gender and Third Party Presence
f1 <- felm(felt_disc ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(trustpremium  ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f3 <- felm(conflict_inev ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f4 <- felm(harmony_poss ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f5 <- felm(vote_coethnic ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f6 <- felm(parties_genuine ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f7 <- felm(e_identity ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f8 <- felm(e_interests ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f9 <- felm(ethnic_party ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f10 <- felm(fear_violence ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f11 <- felm(econ ~ others + male + others_male + age + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,title="Table F12: Interacting Third Party Presence with Gender", dep.var.labels=c("Disc","Trust","Conflict","Harmony","Vote","Genuine","E\\_Identity","E\\_Interests","E\\_Party","Violence","Econ"),covariate.labels=c("Others","Male", "Others*Male","Age","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableF12.tex")
#Appendix Table F13: Association Between Third Party Presence and Additional Variables
f1 <- felm(soaps ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(interest_politics ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f3 <- felm(coord_vote ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,f3,title="Table F13: Association Between Third Party Presence and Additional Variables", dep.var.labels=c("Soap Operas","Interest in Politics","Coordinate Vote"),covariate.labels=c("Others","Male","Age","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableF13.tex")
#Appendix Table F14: Association Between Third Party Presence and Non-Sensitive Outcomes
f1 <- felm(kelectric ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
f2 <- felm(cpec ~ others + age + male + college + muhajir + coenum + large_fam + a_victim|0|0|0, data=data)
stargazer(f1,f2,title="Table F14: Association Between Third Party Presence and Non-Sensitive Outcomes", dep.var.labels=c("Kelectric", "CPEC"),covariate.labels=c("Others","Male","Age","College","Muhajir","Coenum","Lrgfam","Victim"), keep.stat=c("n","rsq")
, out="output/tables/tableF14.tex")
#Appendix Tables F15-F25: Two by Twos of Third Party Presence and Enumerator Coethnicity
tapply(data$econ, list(data$others,data$coenum), mean, na.r=TRUE) #F15
tapply(data$fear_violence, list(data$others,data$coenum), mean, na.r=TRUE) #F16
tapply(data$felt_disc, list(data$others,data$coenum), mean, na.r=TRUE) #F17
tapply(data$vote_coethnic, list(data$others,data$coenum), mean, na.r=TRUE) #F18
tapply(data$parties_genuine, list(data$others,data$coenum), mean, na.r=TRUE) #F19
tapply(data$e_identity, list(data$others,data$coenum), mean, na.r=TRUE)  #F20
tapply(data$e_interests, list(data$others,data$coenum), mean, na.r=TRUE) #F21
tapply(data$ethnic_party, list(data$others,data$coenum), mean, na.r=TRUE) #F22
tapply(data$trustpremium, list(data$others,data$coenum), mean, na.r=TRUE) #F23
tapply(data$conflict_inev, list(data$others,data$coenum), mean, na.r=TRUE) #F24
tapply(data$harmony_poss, list(data$others,data$coenum), mean, na.r=TRUE) #F25
